#ifndef THREAD_H
#define THREAD_H

#include"list.h"
#include"os_constant.h"
#include"address_pool.h"

typedef void (*ThreadFunction)(void*);//函数指针

enum ProgramStatus
{
    CREATED,
    RUNNING,
    READY,
    BLOCKED,
    DEAD
};
//process control block
struct PCB
{
    int* stack;     //栈指针，用于调度时保存esp
    char name[MAX_PROGRAM_NAME+1]; //线程名
    enum ProgramStatus status;      //线程状态
    int priority;   //优先级
    int pid;    //program id
    int ticks;  //时间片总时间
    int ticksPassedBy;  //已执行时间
    int waits;  //已经等待时间，与函数线程age老化机制配合
    ListItem tagInGeneralList;  //队列标识
    ListItem tagInAllList;
    
    int pageDirectoryAddress;   //页目录表地址
    AddressPool userVirtual;
};


#endif